<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTopicsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('topics', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title')->default('')->comment('话题的主题');
            $table->text('content')->comment('话题的内容');
            $table->unsignedInteger('user_id')->default(0)->comment('发布话题的用户id');
            $table->unsignedInteger('column_id')->default(0)->comment('话题所对应栏目的id');
            $table->unsignedInteger('zan_num')->default(0)->comment('话题所获得赞的总数');
            $table->unsignedInteger('favorite_num')->default(0)->comment('话题被收藏的总数');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('topics');
    }
}
